<?php
//
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'set';
if($_RQ['op']=='set'){
	$id=intval($_RQ['id']);
	if($_RQ['postdata']){
		$workerid=pdo_getcolumn('jy_scrm_worker',array('userid'=>$_SESSION['openid'],'uniacid'=>$_SESSION['uniacid']),'id');
		$postdata=get_postdata();
		if(!$postdata['kehuname']){
			exi('请输入客户简称！','error');
		}
		if(!$postdata['workgroupid']){
			exi('请选择任务类型！','error');
		}
		if(!$postdata['wentigroupid']){
			exi('请选择问题类型！','error');
		}
		$nexttime=intval(strtotime($postdata['nexttime']))?:TIMESTAMP+2*24*3600;
		$data=array(
			'workerid'=>$workerid,
			'mid'=>$_SESSION['uid'],
			'status'=>$postdata['status'],
			'istop'=>intval($postdata['istop']),
			'kehuname'=>trim($postdata['kehuname']),
			'workgroupid'=>trim($postdata['workgroupid']),
			'needdays'=>trim($postdata['needdays']),
			'wenti_type'=>trim($postdata['wenti_type']),
			'fankui_type'=>trim($postdata['fankui_type']),
			'msg'=>trim($postdata['msg']),
			'createtime'=>TIMESTAMP,
		);
		$data['uniacid']=$_SESSION['uniacid'];
		pdo_insert('jy_workliu_worklog',$data);
		$nowplugin=$_SESSION['current_plugin']?:'jy_workliu';
		$menus_index=$_SESSION['menus_index']?:$nowplugin.'/index/';
		exi('添加成功！','',$menus_index);
	}
	$workgroup=pdo_getall('jy_workliu_workgroup',array('status'=>1,'uniacid'=>$_SESSION['uniacid']));
	$wentigroup=pdo_getall('jy_workliu_wentigroup',array('status'=>1,'uniacid'=>$_SESSION['uniacid']));
	$return['workgroup']=$workgroup;
	$return['wentigroup']=$wentigroup;
	$return['fankui_types']=$this->fankui_types;
	$return['work_status']=$this->work_status;
	$return['post']=array('needdays'=>'1','status'=>'1');
	set_html('title','+工作日志');
	exi($return);
}
?>